﻿using System;
using System.Globalization;
using System.Windows.Data;
using Soapi.Domain;

namespace Soapi.Contrib.ValueConverters
{
    public class AnsweredColorConverter : IValueConverter
    {
        #region IValueConverter Members

        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if(value==null)
            {
                return "#FF00AA00";
            }
            var q = (Question)value;

            if (q.AcceptedAnswerId.HasValue)
            {
                return "#FF00AA00";
            }

            if (q.AnswerCount == 0)
            {
                return "#FF990000";
            }

            return "#667766";
        }



        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}